home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / lsb-base-logging.sh < prev    next >
Encoding:
Text File  |  2013-01-10  |  1.5 KB  |  71 lines

  1. # Colour our init scripts output
  2.  
  3. # int log_end_message (int exitstatus)
  4. log_end_msg () {
  5.     # If no arguments were passed, return
  6.     if [ -z "${1:-}" ]; then
  7.         return 1
  8.     fi
  9.  
  10.     retval=$1
  11.  
  12.     log_end_msg_pre "$@"
  13.  
  14.     # Only do the fancy stuff if we have an appropriate terminal
  15.     # and if /usr is already mounted
  16.     if log_use_fancy_output; then
  17.         RED=`$TPUT setaf 1`
  18.         GREEN=`$TPUT setaf 2`
  19.         YELLOW=`$TPUT setaf 3`
  20.         NORMAL=`$TPUT sgr0`
  21.         $TPUT hpa $((`$TPUT cols` - 12))
  22.     else
  23.         RED=''
  24.         GREEN=''
  25.         YELLOW=''
  26.         NORMAL=''
  27.     fi
  28.  
  29.     if [ $1 -eq 0 ]; then
  30.         /bin/echo -e " [   ${GREEN}OK${NORMAL}   ]"
  31.     elif [ $1 -eq 255 ]; then
  32.         /bin/echo -e " [${YELLOW}WARNING!${NORMAL}]"
  33.     else
  34.         /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
  35.     fi
  36.     log_end_msg_post "$@"
  37.     return $retval
  38. }
  39.  
  40. log_action_end_msg () {
  41.     log_action_end_msg_pre "$@"
  42.     if [ -z "${2:-}" ]; then
  43.         end=""
  44.     else
  45.         end=" ($2)"
  46.     fi
  47.  
  48.     /bin/echo -n "${end}"
  49.  
  50.     # Only do the fancy stuff if we have an appropriate terminal
  51.     # and if /usr is already mounted
  52.     if log_use_fancy_output; then
  53.         RED=`$TPUT setaf 1`
  54.         BLUE=`$TPUT setaf 4`
  55.         NORMAL=`$TPUT sgr0`
  56.         $TPUT hpa $((`$TPUT cols` - 12))
  57.     else
  58.         RED=''
  59.         BLUE=''
  60.         NORMAL=''
  61.     fi
  62.  
  63.  
  64.     if [ $1 -eq 0 ]; then
  65.         /bin/echo -e " [  ${BLUE}DONE${NORMAL}  ]"
  66.     else
  67.         /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
  68.     fi
  69.     log_action_end_msg_post "$@"
  70. }
  71.